package com.majsubtense.core.components;

public class Transform extends Component {
    public static final ComponentType<Transform> ANY;
    protected float[] position, rotation, scale;

    public Transform(Transform transform) {
        super(Transform.ANY);
        this.position = transform.position;
        this.rotation = transform.rotation;
        this.scale = transform.scale;
    }

    public Transform(float[] position, float[] rotation, float[] scale) {
        super(ComponentType.ROOT);
        this.position = position;
        this.rotation = rotation;
        this.scale = scale;
    }
    public float[] getPosition() {
        return position;
    }

    public float[] getRotation() {
        return rotation;
    }

    public float[] getScale() {
        return scale;
    }

    /**
     * @param transform: Another transform.
     * @brief Deep copy another transform to this.
     * @retval Void.
     */
    public void setTransform(Transform transform) {
        this.position = transform.position;
        this.rotation = transform.rotation;
        this.scale = transform.scale;
    }

    public void setPosition(float[] position) {
        this.position = position;
    }

    public void setPositionX(float x) {
        this.position[0] = x;
    }

    public void setPositionY(float y) {
        this.position[1] = y;
    }

    public void setPositionZ(float z) {
        this.position[2] = z;
    }

    public void setRotation(float[] rotation) {
        this.rotation = rotation;
    }

    public void setScale(float[] scale) {
        this.scale = scale;
    }

    static {
        ANY = new ComponentType<>(ComponentType.ROOT, "TRANSFORM");
    }
}
